package com.zhu.service;

import com.zhu.mapper.InventoryMapper;
import com.zhu.pojo.Inventory;
import com.zhu.pojo.Material;
import com.zhu.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class InventoryService {
    @Autowired
    private InventoryMapper inventoryMapper;
    public List<Inventory> materialList(){
        List<Inventory> list = inventoryMapper.materialList();
        for(Inventory i:list){
            int id = i.getMaterial_id();
            i.setMaterial_name(inventoryMapper.getname(id));
        }
        return list;
    }

    public void storageAdd(List<Integer> list){
        for(int i:list){
            inventoryMapper.storageAdd(i);
        }
    }

    public List<Person> personList(){
        return inventoryMapper.personlist();
    }

    public void dispatch(Map<String,Object> map){
         inventoryMapper.dispatch(map);
    }

    public List<Material> query(Map<String,Object> map){
        return inventoryMapper.query(map);
    }
}
